Skip to content

Export and install test_suite for downstream use#186

Merged
sgerbino merged 1 commit intocppalliance:developfrom
sgerbino:pr/test-suite
Feb 26, 2026
Merged

Export and install test_suite for downstream use#186
sgerbino merged 1 commit intocppalliance:developfrom
sgerbino:pr/test-suite

Conversation

@sgerbino
Copy link
Collaborator

@sgerbino sgerbino commented Feb 26, 2026

Make boost_capy_test_suite and boost_capy_test_suite_main available to downstream consumers via find_package(boost_capy). Add generator expressions for include dirs, EXPORT_NAME properties, Boost:: aliases, and install rules for targets, headers, and CMake modules.

Summary by CodeRabbit

  • Chores
    • Added and installed a public test-suite component so test helpers are available after install.
    • Installed test-suite configuration scripts to enable test discovery in packaged builds.
    • Exposed public aliases and adjusted include paths so the test-suite integrates cleanly for both build and install scenarios.

@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 11581d1 and 0886655.

⛔ Files ignored due to path filters (1)
  • test/unit/CMakeLists.txt is excluded by !**/test/**
📒 Files selected for processing (3)
  • CMakeLists.txt
  • cmake/boost_capy-config.cmake.in
  • extra/test_suite/CMakeLists.txt
🚧 Files skipped from review as they are similar to previous changes (2)
  • extra/test_suite/CMakeLists.txt
  • CMakeLists.txt

📝 Walkthrough

Walkthrough

The PR adds a test_suite subproject, exports two new library targets (boost_capy_test_suite, boost_capy_test_suite_main) with install-aware include paths and aliases, updates package config to include test discovery scripts, and installs the test-suite header and CMake discovery files.

Changes

Cohort / File(s) Summary
Root CMake Configuration
CMakeLists.txt
Adds add_subdirectory(extra/test_suite), expands install(TARGETS ...) to include boost_capy_test_suite and boost_capy_test_suite_main, and installs extra/test_suite/test_suite.hpp plus DiscoverTests.cmake and DiscoverAndWriteTestsScripts.cmake.
CMake Config Integration
cmake/boost_capy-config.cmake.in
Includes DiscoverTests.cmake alongside boost_capy-targets.cmake to enable test discovery at package configuration.
Test Suite Build Configuration
extra/test_suite/CMakeLists.txt
Sets target_include_directories to use BUILD_INTERFACE/INSTALL_INTERFACE, adds EXPORT_NAME properties (capy_test_suite, capy_test_suite_main), and introduces public alias targets Boost::capy_test_suite and Boost::capy_test_suite_main.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰✨ I hopped into CMake's glade today,
New test-suite roots in tidy array,
BUILD and INSTALL paths side by side,
Aliases spring, discovery as guide,
A tiny rabbit cheers, "Tests shall play!"

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main objective of the pull request: exporting and installing test_suite libraries for downstream consumers.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cppalliance-bot
Copy link

cppalliance-bot commented Feb 26, 2026

An automated preview of the documentation is available at https://186.capy.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-02-26 10:50:43 UTC

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
extra/test_suite/CMakeLists.txt (1)

26-28: Redundant include directories.

Since boost_capy_test_suite_main links PUBLIC to boost_capy_test_suite (line 25), it already inherits the include directories. This explicit target_include_directories call is redundant.

♻️ Proposed fix: Remove redundant include directories
 # Library target that links the previous and adds test_main.cpp
 add_library(boost_capy_test_suite_main STATIC test_main.cpp)
 target_link_libraries(boost_capy_test_suite_main PUBLIC boost_capy_test_suite)
-target_include_directories(boost_capy_test_suite_main PUBLIC
-    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
-    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/boost/capy/extra/test_suite>)
 target_compile_features(boost_capy_test_suite_main PUBLIC cxx_std_17)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@extra/test_suite/CMakeLists.txt` around lines 26 - 28, Remove the redundant
target_include_directories call for boost_capy_test_suite_main: since
boost_capy_test_suite_main already links PUBLIC to boost_capy_test_suite (which
exports its include dirs), delete the target_include_directories(...) block
referencing $<BUILD_INTERFACE:...> and $<INSTALL_INTERFACE:...>; leave the
existing target_link_libraries(boost_capy_test_suite_main PUBLIC
boost_capy_test_suite) as-is so include directories continue to be propagated.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@extra/test_suite/CMakeLists.txt`:
- Around line 18-20: The INSTALL_INTERFACE uses CMAKE_INSTALL_INCLUDEDIR which
may be undefined because include(GNUInstallDirs) happens after
add_subdirectory(extra/test_suite); fix by ensuring GNUInstallDirs is included
before the subdirectory is processed (i.e., move or add include(GNUInstallDirs)
earlier in the parent CMakeLists so CMAKE_INSTALL_INCLUDEDIR is defined when
target_include_directories in boost_capy_test_suite is evaluated), or
alternatively provide a fallback default for CMAKE_INSTALL_INCLUDEDIR before
referencing it.

---

Nitpick comments:
In `@extra/test_suite/CMakeLists.txt`:
- Around line 26-28: Remove the redundant target_include_directories call for
boost_capy_test_suite_main: since boost_capy_test_suite_main already links
PUBLIC to boost_capy_test_suite (which exports its include dirs), delete the
target_include_directories(...) block referencing $<BUILD_INTERFACE:...> and
$<INSTALL_INTERFACE:...>; leave the existing
target_link_libraries(boost_capy_test_suite_main PUBLIC boost_capy_test_suite)
as-is so include directories continue to be propagated.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2c3a07d and 11581d1.

⛔ Files ignored due to path filters (1)
  • test/unit/CMakeLists.txt is excluded by !**/test/**
📒 Files selected for processing (3)
  • CMakeLists.txt
  • cmake/boost_capy-config.cmake.in
  • extra/test_suite/CMakeLists.txt

Make boost_capy_test_suite and boost_capy_test_suite_main available
to downstream consumers via find_package(boost_capy). Add generator
expressions for include dirs, EXPORT_NAME properties, Boost:: aliases,
and install rules for targets, headers, and CMake modules.
@cppalliance-bot
Copy link

GCOVR code coverage report https://186.capy.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://186.capy.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://186.capy.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-02-26 10:58:17 UTC

@sgerbino sgerbino merged commit 74ae330 into cppalliance:develop Feb 26, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants